import { defineComponent, onMounted } from "vue";

let container: null | SVGElement = null;
function initContainer() {
  container =
    container || document.createElementNS("http://www.w3.org/2000/svg", "svg");
  document.body.appendChild(container);
}

export default defineComponent({
  props: {
    type: String,
  },

  setup() {
    onMounted(() => {
      initContainer();
    });
  },
  render() {
    <svg
      xmlns="http://www.w3.org/2000/svg"
      aria-hidden="true"
      role="img"
      class="iconify iconify--mdi-light"
      width="1em"
      height="1em"
      preserveAspectRatio="xMidYMid meet"
      viewBox="0 0 24 24"
    >
      <use xlinkHref={"#" + this.type} x="0" y="0" width="24" height="24" />
    </svg>;
  },
});
